package com.woniuxy.creditsystem.statisticsmag.service.impl;

import com.woniuxy.creditsystem.common.bean.DataDetailInfo;
import com.woniuxy.creditsystem.common.mapper.DataDetailMapper;
import com.woniuxy.creditsystem.statisticsmag.service.IDataDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional(readOnly = true)
@Service
public class DataDetailServiceImpl implements IDataDetailService {

    @Resource
    private DataDetailMapper dataDetailMapper;

    /**
     * 查询所有的数据明细
     * @return 数据明细集合
     */
    @Override
    public List<DataDetailInfo> findAll() {
        return dataDetailMapper.findAll();
    }

    /**
     * 添加每日的数据明细
     * @param dataDetailInfo
     * @return
     */
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public int saveDataDetail(DataDetailInfo dataDetailInfo) {
        return dataDetailMapper.saveDataDetail(dataDetailInfo);
    }
}
